package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.StoreInfoDao;
import cn.topevery.garden.entity.po.StoreInfo;
import cn.topevery.garden.entity.query.StoreInfoQuery;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 *
 * @author code-generate
 * @date 2021-08-30
 */
@Service
public class StoreInfoLogic extends BaseLogic<StoreInfo> {
    @Autowired
    StoreInfoDao storeInfoDao;

    @Override
    public BaseEntityDao<StoreInfo, Integer> getDao() {
        return storeInfoDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<StoreInfo> listPage(StoreInfoQuery query) {
        return storeInfoDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        storeInfoDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param storeInfo 实体
     */
    public void saveOrUpdate(String userId, StoreInfo storeInfo){
        storeInfoDao.saveOrUpdate(userId,storeInfo);
    }

    /**
     * 描述 检查是否存在.
     *
     * @param fieldName the field name
     * @param value     the value
     * @return the boolean
     * @author wenzhao.lin
     * @created 2021 -08-30 09:39:53 Is exit boolean.
     */
    public boolean isExit(String fieldName, String value){
        return storeInfoDao.isExit(fieldName, value);
    }

    /**
     * 描述 获取列表.
     *
     * @param fieldName the field name
     * @param value     the value
     * @return the list
     * @author wenzhao.lin
     * @created 2021 -08-30 13:46:46 Get store list list.
     */
    public List<StoreInfo> getStoreList(String fieldName, String value){
        return storeInfoDao.getStoreList(fieldName, value);
    }
}
